Star Sphere with Scalable Stars

by Julian Fong

Version 1.0 - December 22, 2004


These files were created in Animation:Master version 11.1b. They may be compatible with version 10.x, but I haven't tested them to see if it's possible. Because of the use of expressions, they are not compatible with any earlier version of Animation:Master. Details on how this project was created can be found in this thread in the Hash forums.


Contents

This folder contains the following files:

StarSphere.mdl
This star sphere model with scalable stars consists of 2048 circular patches, with diameters ranging randomly from 7.5 to 22.5 meters, arranged randomly to form a spherical shell 10000 meters in radius, and oriented so that their normals point toward the origin. Each patch is assigned to a 15 meter long hidden bone which coincides with the normal of the patch. A pose slider called "Median star size in meters" scales all the bones in the X and Y axes so that the median size of the stars ranges from 0 to 30 meters; the default is 15 meters. The entire model is white with 100% ambiance, but the variation in the size of the stars creates variations in brightness without resorting to a procedural material.

StarSphere Replicate.act
An action for StarSphere.mdl that creates 15 duplicates of the star sphere as action objects. The duplicates all have different orientations and are reflected across different combinations of axes. An expression applied to each duplicate sets the value of its "Median star size in meters" pose slider to the same value as the slider in the parent object. With this action applied, the total number of stars is 32768.

StarSphere_scalable.cho
This choreography contains StarSphere.mdl with StarSphere Replicate.act applied to it, as well as an embedded sun light with 100% shadow darkness, and a camera with a 35 mm focal length and a black background, rendering at 640x480 resolution. The star size is set to 12 m, which is a good setting for producing 1-pixel stars with this camera. Because of the large number of bones in the scalable star sphere and its duplicates, this choreography may take several minutes to open, depending on the CPU speed of your computer.

StarSphere-05m.mdl, StarSphere-08m.mdl, StarSphere-10m.mdl, StarSphere-12m.mdl
These versions of the star sphere model have non-scalable stars fixed at a median size of 5, 8, 10 and 12 meters respectively. All bones and the pose slider have been removed, which makes them load much faster in a choreography than the scalable model.

StarSphere Fixed Replicate.act
By default, this action is applied to StarSphere-12m.mdl and creates 15 duplicates of it with the same orientation as in the scalable version. Using this file with the other fixed star models requires editing with a text editor (see below).

StarSphere_fixed.cho
By default, this choreography contains StarSphere-12m.mdl with Star Sphere Fixed Replicate.act applied to it, and the same sun light and camera as StarSphere_scalable.cho.


Using the scalable star sphere

The purpose of these files is to allow fast rendering of space (or night sky) scenes in which the stars occupy approximately one pixel in the frame. The size of the stars can be adjusted to account for the zoom setting of the camera and the resolution of the render. The "Median star size in meters" pose slider in StarSphere.mdl has a range of 0 to 30 with a default of 15 -- you can ignore the percent symbol in the slider value, because this value is not actually a scaling percentage. It represents the size in meters of the middle of the range of star sizes, a range which varies from 50% to 150% of the median.

Here's how to determine what star size is right for your camera setting. The relationship between the focal length and the angle of view in an A:M camera is based on the camera having a horizontal aperture of 35 mm. We will assume that a camera (shown in light gray) with focal length f, producing renders with a maximum dimension of W pixels, is located at the center of a star sphere with radius R. Let angle A be the camera's angle of view, and let angle C be the angle subtended by one star (shown in yellow). The size s that the star needs to be in order to appear as one pixel may be derived by this method:

s = 2R tan (atan (17.5 / f) / W)

Since R = 10000 m in this model, the following values of s in meters (as well as A) may be obtained by plugging the given camera settings into this formula:

Focal length
(f)
Angle of view
(A)
Resolution (W) in pixels
320 640 720 800 1024 1280
30 mm 60.51° 33.00 16.50 14.67 13.20 10.31 8.25
35 mm 53.13° 28.98 14.49 12.88 11.59 9.06 7.24
50 mm 38.58° 21.04 10.52 9.35 8.42 6.58 5.26
70 mm 28.07° 15.31 7.66 6.80 6.12 4.78 3.83
100 mm 19.85° 10.83 5.41 4.81 4.33 3.38 2.71

Apply the formula, s = 2 * 10000 * tan [atan (17.5 / f) / W], directly to obtain star size values for camera settings not covered by this table. The resolution, W, is the largest dimension of the rendered frame, so if you're rendering in portrait format instead of landscape, you should consider W to be the height instead of the width.

Note that if you actually try to use the obtained value of s to set the pose slider in the choreography, the starfield may appear to be too bright because of the oversized stars produced by the random scaling distribution in the model. You can make the starfield dimmer by lowering the value of the pose slider to about 80% of the original value -- this is why in the default choreography, where the camera has a focal length of 35 mm and a resolution of 640 pixels, I have made the star size 12 m instead of 14.49 as given by the formula. However, reducing the size of the stars may cause flickering when panning the camera with antialiasing turned on. As an alternative to lowering the pose slider value, you can make the overall color of the star sphere model a shade of gray instead of white.

Another advantage of the scalable star sphere is the ability to animate the star size to stay in sync with the animation of the camera's focal length. If the camera will be making a zoom move in the course of the choreography, you will need to keyframe the "Median star size in meters" pose slider on the same frames as the keyframes you set for the beginning and end of the zoom. The new value of the pose slider at the end of the zoom will need to be calculated using the formula or the table, based on the new focal length.

If the camera will be moving a considerable distance away from the center of the star sphere during the choreography, as it approaches the edge of the sphere it will become apparent that some of the stars are closer to the camera, and therefore brighter, than others. You can remedy this either by constraining the star sphere to translate to the camera, or by scaling up the entire star sphere from its model bone. It will also be necessary to scale up the star sphere if the objects included in the scene are too big to fit into the existing volume. Scaling the star sphere will not affect the angular size of the stars, and the replicated action objects will follow the translation and scaling of the parent object.


Using the fixed-size star spheres

Fixed-size star spheres are best suited for applications where you don't expect to be animating the camera's focal length, and you can't afford to wait for the scalable star sphere to load. Consult the formula and table above to determine which star size is best suited for your camera's settings.

A choreography and a replication action are provided using the sphere with 12-meter stars. If you want to use them with a different fixed-size sphere, you will need to open StarSphere Fixed Replicate.act in a text editor. Search for "StarSphere-12m" and replace it with the filename of the sphere you want to use. Once you have resaved the action, open StarSphere_fixed.cho in A:M. In the Project Workspace, expand the choreography and select Shortcut to StarSphere-12m. In its "Shortcut To" property, click on StarSphere-12m and choose the new star sphere from the pull-down menu.

If none of the included fixed-size spheres have the right star size for your needs, you can create a new fixed-size sphere yourself. Create a new action and edit it using the scalable star sphere (StarSphere.mdl). Set the pose slider to the desired size. Right-click on the action in the PWS, select Export > Model (*.MDL), and save the model under a new name; this may take some time. Close the action and open the model you just created. Expand it using its + button in the PWS. Select the Bones and Relationships folders and delete them. Save the model.


Acknowledgements

The star sphere concept was inspired by a model by Carmen Rizzolo, available at AnimationPitStop.com. Grateful acknowledgement is made to Yves Poissant and Anders Averö for their valuable programming advice.